//
//  UIButton+Extension.m
//  shusheng
//
//  Created by rimi on 16/7/9.
//  Copyright © 2016年 yuying. All rights reserved.
//

#import "UIButton+Extension.h"

@implementation UIButton (Extension)

+ (UIButton *)createButton:(CGRect)frame
                   center:(CGPoint)center
                    color:(UIColor *)color
             cornerRadius:(CGFloat)cornerRadius
            masksToBounds:(BOOL)masksToBounds
                    title:(NSString *)string
                      tag:(NSInteger)tag{
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.bounds = frame;
    btn.center = center;
    btn.backgroundColor = color;
    btn.titleLabel.numberOfLines = 0;
    btn.titleLabel.textAlignment = 1;
    btn.titleLabel.font = [UIFont systemFontOfSize:20];
    btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    btn.layer.cornerRadius = cornerRadius;//圆角
    btn.layer.masksToBounds = masksToBounds;
    [btn setTitle:string forState:UIControlStateNormal];
    [btn setTag:tag];
    
    return btn;
}

+ (UIButton *)creatSideBtnCenter:(CGPoint)center
                           color:(UIColor *)color
                           title:(NSString *)string
                             tag:(NSInteger)tag{
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.bounds = CGRectMake(0, 0, 50, 50);
    btn.center = center;
    btn.backgroundColor = color;
    btn.titleLabel.numberOfLines = 0;
    btn.titleLabel.textAlignment = 1;
    btn.titleLabel.font = [UIFont systemFontOfSize:18];
    btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    btn.layer.cornerRadius = 25;//圆角
    btn.layer.masksToBounds = YES;
    [btn setTitle:string forState:UIControlStateNormal];
    [btn setTag:tag];
    
    return btn;
    
}

@end
